package builder.room
{
	import builder.IRoomBuilder;
	
	import display.FreeLine;
	import display.Line;
	import display.Wall;
	
	import flash.geom.Point;
	
	import mx.graphics.IStroke;
	
	public class RectRoomBuilder implements IRoomBuilder
	{
		public function RectRoomBuilder()
		{
			
		}
		
		public function buildWalls(width:Number, height:Number, stroke:IStroke):Array
		{
			var array:Array = [];
			
			var point_tl:Point = new Point(0, 0);
			var point_tr:Point = new Point(width, 0);
			var point_bl:Point = new Point(0, height);
			var point_br:Point = new Point(width, height);
			
			//top
			var wall:Wall = new Wall();
			var line:Line = new Line([point_tl, point_tr], stroke);
			var freeLine:FreeLine = new FreeLine();
			freeLine.lines = [line];
			wall.freeLines = [freeLine];	
			array.push(wall);
			
			//left
			var wall:Wall = new Wall();
			var line:Line = new Line([point_tl, point_bl], stroke);
			var freeLine:FreeLine = new FreeLine();
			freeLine.lines = [line];
			wall.freeLines = [freeLine];
			array.push(wall);
			
			//bottom
			var wall:Wall = new Wall();
			var line:Line = new Line([point_bl,point_br], stroke);
			var freeLine:FreeLine = new FreeLine();
			freeLine.lines = [line];
			wall.freeLines = [freeLine];
			array.push(wall);
			
			//right
			var wall:Wall = new Wall();
			var line:Line = new Line([point_tr, point_br], stroke);
			var freeLine:FreeLine = new FreeLine();
			freeLine.lines = [line];
			wall.freeLines = [freeLine];
			array.push(wall);
			
			return array;
		}
	}
}